package com.zhou.jiancai.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.zhou.jiancai.R;
import com.zhou.jiancai.ui.MySnailView.MySnailView;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/6/9.
 */

public class CircleViewActivity extends AppCompatActivity{

    public final static int MODEL_COUNT = 4;
    // Parsed colors
    private int[] mStartColors = new int[MODEL_COUNT];
    private int[] mEndColors = new int[MODEL_COUNT];
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.circle_view_activity);

    // Get colors
    final String[] startColors = getResources().getStringArray(R.array.polluted_waves);
    final String[] endColors = getResources().getStringArray(R.array.default_preview);
    final String[] bgColors = getResources().getStringArray(R.array.medical_express);

    // Parse colors
        for (int i = 0; i < MODEL_COUNT; i++) {
        mStartColors[i] = Color.parseColor(startColors[i]);
        mEndColors[i] = Color.parseColor(endColors[i]);
    }

    // Set models
    final ArrayList<MySnailView.Model> models = new ArrayList<>();
        models.add(new MySnailView.Model("Circle", 0, Color.parseColor(bgColors[0]), mStartColors[0]));
        models.add(new MySnailView.Model("Progress", 0, Color.parseColor(bgColors[1]), mStartColors[1]));
        models.add(new MySnailView.Model("Stack", 0, Color.parseColor(bgColors[2]), mStartColors[2]));
        models.add(new MySnailView.Model("View", 0, Color.parseColor(bgColors[3]), mStartColors[3]));

        final MySnailView MySnailView = (MySnailView) findViewById(R.id.apsv);
        MySnailView.setModels(models);
    }
}
